﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yitter.IdGenerator;

namespace RBAC_Model
{
    public class Permission : BaseEntity // ✅ 继承BaseEntity
    {
        /// <summary>
        /// 权限名称
        /// </summary>
        [Required]
        [StringLength(50)]
        public string PermissionName { get; set; }

        /// <summary>
        /// 权限描述
        /// </summary>
        [StringLength(200)]
        public string Description { get; set; }

        /// <summary>
        /// 权限模块
        /// </summary>
        [StringLength(50)]
        public string Module { get; set; }

        // 新增字段
        public string ResourceType { get; set; }   // 资源类型，如Menu/Button/Page/Data等
        public string ResourceKey { get; set; }    // 资源唯一标识，如"Menu.User", "Button.Order.Delete"
        /// <summary>
        /// 权限构造函数
        /// </summary>
        //public Permission()
        //{
            
        //    Id = YitIdHelper.NextId(); // ✅ 在构造函数中生成ID
        //    CreateTime = DateTime.Now;
        //    UpdateTime = DateTime.Now;
      //}
    }
}
